$(document).ready(function () {
    let firstName = sessionStorage.getItem("firstName");
    let lastName = sessionStorage.getItem("lastName");
    let IdNumber = sessionStorage.getItem("userIdentityNumber");
    let email = sessionStorage.getItem("userEmail");

    if(email == null){
        window.location.href="../LoginPage/login.html";
    }
    $("#showUserName").text(firstName+"   "+lastName);
    $("#showUserEmail").text(email);


    $.ajax({
        type: "GET",
        url: SERVER_URL+"/user/doctor",
        async: true,
        dataType: "json",
        success: function (data) {
           $("#doctorCount").text(data.data);
            //console.log(data.data);
        }
    });

    $.ajax({
        type: "GET",
        url: SERVER_URL+"/appointment/"+email,
        async: true,
        dataType: "json",
        success: function (data) {
            $("#appointmentCount").text(data.data.length);
            //console.log(data.data);
        }
    });
})